package com.example.demo.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.Employee;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {


    Employee selectByUsername(String username);

    //分页
//    @Select({"<script>",
//            "SELECT * FROM employee",
//            "<where>",
//            "<if test='username != null and username != \"\"'>",
//            "  username LIKE CONCAT('%', #{username}, '%')" +
//                    " or id LIKE #{username}" +
//                    " or nick_name LIKE CONCAT('%', #{username}, '%') or age LIKE #{username} or sex LIKE CONCAT('%',#{username}, '%') or telephone LIKE #{username}",
//            "</if>",
//            "</where>",
//            "LIMIT #{pageNum}, #{pageSize}",
//            "</script>"})
//    List<Employee> selectPage(Integer pageNum, Integer pageSize,String username);

//    @Select({"<script>" +
//            "select count(*) from employee\n" +
//            "        <where>\n" +
//            "            <if test=\"username != null and username != ''\">\n" +
//            "                username like concat('%',#{username},'%' ) or id LIKE #{username} or nick_name LIKE CONCAT('%', #{username}, '%') or age LIKE #{username} or sex LIKE CONCAT('%',#{username},'%') and telephone  LIKE #{username}\n" +
//            "            </if>\n" +
//            "        </where></script>"})
//    Integer selectTotall(String username);


    Employee loginEmployee(String username);

    void updatePassowrd(Employee employee);
}
